_init : function() {
this._shellwm = global.window_manager;
- this._keyBindingHandlers = [];
this._minimizing = [];
this._maximizing = [];
this._unmaximizing = [];
this._shellwm.connect('destroy', Lang.bind(this, this._destroyWindow));
this._workspaceSwitcherPopup = null;
- this.setKeybindingHandler('switch-to-workspace-left', Lang.bind(this, this._showWorkspaceSwitcher));
- this.setKeybindingHandler('switch-to-workspace-right', Lang.bind(this, this._showWorkspaceSwitcher));
- this.setKeybindingHandler('switch-to-workspace-up', Lang.bind(this, this._showWorkspaceSwitcher));
- this.setKeybindingHandler('switch-to-workspace-down', Lang.bind(this, this._showWorkspaceSwitcher));
- this.setKeybindingHandler('switch-windows', Lang.bind(this, this._startAppSwitcher));
- this.setKeybindingHandler('switch-group', Lang.bind(this, this._startAppSwitcher));
- this.setKeybindingHandler('switch-windows-backward', Lang.bind(this, this._startAppSwitcher));
- this.setKeybindingHandler('switch-group-backward', Lang.bind(this, this._startAppSwitcher));
- this.setKeybindingHandler('switch-panels', Lang.bind(this, this._startA11ySwitcher));
+ Meta.keybindings_set_custom_handler('switch-to-workspace-left',
+ Lang.bind(this, this._showWorkspaceSwitcher));
+ Meta.keybindings_set_custom_handler('switch-to-workspace-right',
+ Lang.bind(this, this._showWorkspaceSwitcher));
+ Meta.keybindings_set_custom_handler('switch-to-workspace-up',
+ Lang.bind(this, this._showWorkspaceSwitcher));
+ Meta.keybindings_set_custom_handler('switch-to-workspace-down',
+ Lang.bind(this, this._showWorkspaceSwitcher));
+ Meta.keybindings_set_custom_handler('switch-windows',
+ Lang.bind(this, this._startAppSwitcher));
+ Meta.keybindings_set_custom_handler('switch-group',
+ Lang.bind(this, this._startAppSwitcher));
+ Meta.keybindings_set_custom_handler('switch-windows-backward',
+ Lang.bind(this, this._startAppSwitcher));
+ Meta.keybindings_set_custom_handler('switch-group-backward',
+ Lang.bind(this, this._startAppSwitcher));
+ Meta.keybindings_set_custom_handler('switch-panels',
+ Lang.bind(this, this._startA11ySwitcher));
Main.overview.connect('showing', Lang.bind(this, function() {
for (let i = 0; i < this._dimmedWindows.length; i++)
}));
},
- setKeybindingHandler: function(keybinding, handler){
- if (this._keyBindingHandlers[keybinding])
- this._shellwm.disconnect(this._keyBindingHandlers[keybinding]);
- else
- this._shellwm.takeover_keybinding(keybinding);
-
- this._keyBindingHandlers[keybinding] =
- this._shellwm.connect('keybinding::' + keybinding, handler);
- },
-
blockAnimations: function() {
this._animationBlockCount++;
},
shellwm.completed_switch_workspace();
},
- _startAppSwitcher : function(shellwm, binding, mask, window, backwards) {
+ _startAppSwitcher : function(display, screen, window, binding) {
/* prevent a corner case where both popups show up at once */
if (this._workspaceSwitcherPopup != null)
this._workspaceSwitcherPopup.actor.hide();
let tabPopup = new AltTab.AltTabPopup();
- if (!tabPopup.show(backwards, binding, mask))
+ let modifiers = binding.get_modifiers();
+ let backwards = modifiers & Meta.VirtualModifier.SHIFT_MASK;
+ if (!tabPopup.show(backwards, binding.get_name(), binding.get_mask()))
tabPopup.destroy();
},
- _startA11ySwitcher : function(shellwm, binding, mask, window, backwards) {
- Main.ctrlAltTabManager.popup(backwards, mask);
+ _startA11ySwitcher : function(display, screen, window, binding) {
+ let modifiers = binding.get_modifiers();
+ let backwards = modifiers & Meta.VirtualModifier.SHIFT_MASK;
+ Main.ctrlAltTabManager.popup(backwards, binding.get_mask());
},
- _showWorkspaceSwitcher : function(shellwm, binding, mask, window, backwards) {
- if (global.screen.n_workspaces == 1)
+ _showWorkspaceSwitcher : function(display, screen, window, binding) {
+ if (screen.n_workspaces == 1)
return;
if (this._workspaceSwitcherPopup == null)
this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
- if (binding == 'switch-to-workspace-up')
+ if (binding.get_name() == 'switch-to-workspace-up')
this.actionMoveWorkspaceUp();
- else if (binding == 'switch-to-workspace-down')
+ else if (binding.get_name() == 'switch-to-workspace-down')
this.actionMoveWorkspaceDown();
// left/right would effectively act as synonyms for up/down if we enabled them;
// but that could be considered confusing.
- // else if (binding == 'switch-to-workspace-left')
+ // else if (binding.get_name() == 'switch-to-workspace-left')
// this.actionMoveWorkspaceLeft();
- // else if (binding == 'switch-to-workspace-right')
+ // else if (binding.get_name() == 'switch-to-workspace-right')
// this.actionMoveWorkspaceRight();
},
KILL_SWITCH_WORKSPACE,
KILL_WINDOW_EFFECTS,
- KEYBINDING,
-
LAST_SIGNAL
};
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
META_TYPE_WINDOW_ACTOR);
-
- /**
- * ShellWM::keybinding:
- * @shellwm: the #ShellWM
- * @binding: the keybinding name
- * @mask: the modifier mask used
- * @window: for window keybindings, the #MetaWindow
- * @backwards: for "reversible" keybindings, whether or not
- * the backwards (Shifted) variant was invoked
- *
- * Emitted when a keybinding captured via
- * shell_wm_takeover_keybinding() is invoked. The keybinding name
- * (which has underscores, not hyphens) is also included as the
- * detail of the signal name, so you can connect just specific
- * keybindings.
- */
- shell_wm_signals[KEYBINDING] =
- g_signal_new ("keybinding",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
- 0,
- NULL, NULL,
- _shell_marshal_VOID__STRING_UINT_OBJECT_BOOLEAN,
- G_TYPE_NONE, 4,
- G_TYPE_STRING,
- G_TYPE_UINT,
- META_TYPE_WINDOW,
- G_TYPE_BOOLEAN);
}
void
return wm;
}
-
-static void
-shell_wm_key_handler (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding,
- gpointer data)
-{
- ShellWM *wm = data;
- gboolean backwards = (event->xkey.state & ShiftMask);
-
- g_signal_emit (wm, shell_wm_signals[KEYBINDING],
- g_quark_from_string (binding->name),
- binding->name, binding->mask, window, backwards);
-}
-
-/**
- * shell_wm_takeover_keybinding:
- * @wm: the #ShellWM
- * @binding_name: a meta keybinding name
- *
- * Tells mutter to forward keypresses for @binding_name to the shell
- * rather than processing them internally. This will cause a
- * #ShellWM::keybinding signal to be emitted when that key is pressed.
- */
-void
-shell_wm_takeover_keybinding (ShellWM *wm,
- const char *binding_name)
-{
- meta_keybindings_set_custom_handler (binding_name,
- shell_wm_key_handler,
- wm, NULL);
-}